﻿using _1_Interfaces.Interfaces.Cjw;
using _1_Interfaces.Models.Dtos.Cjw;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace _3_Controllers.Controllers.Cjw
{
    /// <summary>
    /// 操作记录表服务
    /// </summary>
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class CjwOperationListController : ControllerBase
    {
        private IOperationListService _operationListService;
        public CjwOperationListController(IOperationListService operationListService)
        {
            _operationListService = operationListService;
        }

        /// <summary>
        /// 关于操作记录插入
        /// </summary>
        /// <param name="operationListAddDto"></param>
        [HttpPost]
        public void InsertOpData(OperationListAddDto operationListAddDto)
        {
            _operationListService.InsertOpData(operationListAddDto);
        }

        /// <summary>
        /// 获取操作日志
        /// </summary>
        /// <param name="startTime">开始时间</param>
        /// <param name="endTime">结束时间</param>
        /// <param name="pageIndex">第几页</param>
        /// <param name="pageSize">一页几条</param>
        /// <returns></returns>
        [HttpGet]
        public OperationListDto GetOpList(string startTime, string endTime, int pageIndex, int pageSize)
        {
            return _operationListService.GetOpList(startTime, endTime, pageIndex, pageSize);
        }
    }
}
